package com.isoftstone.merchant.controller.notify;

import com.isoftstone.bank.controller.base.BaseController;
import com.isoftstone.common.Page;
import com.isoftstone.common.Tidings;
import com.isoftstone.merchant.entity.notify.BNotify;
import com.isoftstone.merchant.service.notice.INotifyService;
import com.isoftstone.util.Const;
import com.isoftstone.util.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * Created by as on 2017/12/25.
 * 商户端银行公告
 */
@Controller
public class BankMereNotifyController extends BaseController{
    @Autowired
    INotifyService notifyService;
    @RequestMapping("merchant/notice/getBankNotifyListPage")
    public ModelAndView toBankNotify(){
        ModelAndView md=new ModelAndView();
        md.setViewName("merchant/notice/notice_bank");
        return  md;
    }
    @RequestMapping("merchant/notice/getBankNotifyListPage1")
    @ResponseBody
    public Object BankNotify(Page page){
        PageData pd = this.getPageData();
        Tidings<List<BNotify>> tidings = new Tidings<List<BNotify>>();
        String userid = this.getUser().getUserid();
        pd.put("notifyType","03");//缴费单位管理人员
        pd.put("creatorType","01");//银行管理人员
        pd.put("status","1");//1正常//0撤回//2草稿
        pd.put("userId",userid);//登录者id
        pd.put("userType","02");//02缴费单位人员
        page.setPd(pd);
        try {
            List<BNotify>bNotifyList=notifyService.findBankNotifylistPage(page);
            tidings.setStatus(Const.SUCCESS);
            tidings.setT(bNotifyList).setPage(page);
        } catch (Exception e) {
            e.printStackTrace();
            tidings.setStatus(Const.SUCCESS);
            tidings.setMsg("数据异常");
        }
        return tidings;
    }
}
